<%-- 
    Document   : complaintsList
    Created on : Oct 17, 2012, 9:15:38 AM
    Author     : DinhThang
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Complaints List</title>
            <link rel="stylesheet" type="text/css" href="../styles/style.css" />
        </head>
        <body>        
            <jsp:include page="../includes/incHeader.jsp" flush="false" />
            <h3>Complaints List</h3>
            <h:form>
                <center>
                    <h:commandLink value="New Complaint" action="#{complaintsBean.prepareData4AddComplaint}">
                        <f:param name="idParam" value="#{login.userid}"/>
                    </h:commandLink>
                    <br/>
                    <br/>
                    <h:commandLink value="Replied" action="#{complaintsBean.prepareData4ListReplied}" />
                    &nbsp;&nbsp;
                    <h:commandLink value="Not Replied" action="#{complaintsBean.prepareData4ListNotReplied}" />
                </center>
                <h:messages/>
                <center>
                    <h:outputText value="No Complaints and reply" rendered="#{empty complaintsBean.complaintsList}"/></center>
                    <br />
                    <h:dataTable style="margin:0 auto; border:1px solid #999" value="#{complaintsBean.complaintsList}" var="complaints" rendered="#{not empty complaintsBean.complaintsList}">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Details"/>
                            </f:facet>
                            <h:commandLink value="Detail" action="#{complaintsBean.prepareData4Detail}">
                                <f:param name="idParam" value="#{complaints.complaintID}"/>
                            </h:commandLink>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Title"/>
                            </f:facet>
                            <h:outputText value="#{complaints.title}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Department Name"/>
                            </f:facet>
                            <h:outputText value="#{complaints.departmentName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Create Time"/>
                            </f:facet>
                            <h:outputText value="#{complaints.createTime}">
                                <f:convertDateTime type="date" dateStyle="long" />
                            </h:outputText>
                        </h:column>

                    <h:column>
                        <f:facet name="header">
                            <h:outputText value="Delete"/>
                        </f:facet>
                        <h:commandLink value="Del" action="#{complaintsBean.prepareData4Delete}">
                            <f:param name="idParam" value="#{complaints.complaintID}"/>
                        </h:commandLink>
                    </h:column>
                </h:dataTable>
            </h:form>
        </body>
    </html> 
</f:view>


